# 爬取搜狗首页的页面数据
from typing import Mapping
import requests
from requests.api import request
if __name__=="__main__":
    #step 1:指定url
    url='https://www.sogou.com/'

    #step 2:发起请求
    #get方法会返回一个响应对象
    res=requests.get(url=url)

    #step 3:获取响应数据, text反蝴蝶是字符串形式的响应数据
    page_text = res.text
    print(page_text)

    #step 4:持久化存储 
    with open('./sougou.html','w',encoding='utf-8') as fp:
        fp.write(page_text)
    
    print('爬取数据结束！')
